<template>
    <div class="contentlist">
        <div class=" mb20 storeInfo">
            <div class="center fontbold mb10">店铺信息</div>
            <div>
                <div><span class="color666">店铺名称：</span>{{storeInfo.depot_name}}</div>
                <div><span class="color666">所属品牌：</span>{{storeInfo.brand_name}}</div>
                <div><span class="color666">所属区域：</span>{{storeInfo.area_name}}</div>
            </div>
        </div>
        <div v-if="list.length>0">
            <van-list
                v-model="loading"
                :finished="finished"
                :finished-text="finishedTxt"
                :immediate-check='false'
                offset=20
                @load="goPullup"
                class="vantList"
            >
                <div class="flex flexBetween list whiteBg mb10" v-for="(item,index) in list" :key="index">
                    <div class="fontbold fontSize16">￥{{item.amount}}</div>
                    <div>{{item.sale_date}}</div>
                </div>
            </van-list>
        </div>
        <div v-if="list.length==0" class="txt center color666">暂无记录~</div>
    </div>
</template>
<script>
import { Toast} from 'vant'
import {GetQueryStr} from '@/common/common.js'
export default{
    data(){
        return{
            storeVal:'',
            list:[],
            loading:true,
            finished:false,
            finishedTxt:'没有更多了',
            page:1,
            storeName:'',
            storeInfo:{}
        }
    },
    created(){
        
        this.storeVal=this.$route.query.storeVal
        this.storeName=this.$route.query.storeName
        console.log('-----',this.$route.query.storeName)
        this.getPresaleList()
    },
    methods:{
        getPresaleList(){
            let obj={
                page:this.page,
                code:this.storeVal
            }
            Toast.loading({
                message: '加载中',
                forbidClick: true,
                duration:0
            })
            this.$apiRequest.getPresaleList(obj).then(res=>{
                console.log('历史记录',res)
                this.loading = false
                Toast.clear()
                if(res.code==1){
                    this.storeInfo=res.data.depot_info
                    // this.list=res.data.data
                    let list=res.data.data
                    if(list.length===0){
                        this.page==1?this.list=[]:''
                        this.page==1?this.finishedTxt='':''
                        this.finished=true
                        return 
                    }
                    if(this.page==1){
                        this.list=list
                        this.finishedTxt=''
                    }else{
                        this.list=this.list.concat(list)
                    }
                }
            })
        },
        goPullup(){//上拉
            console.log('上拉啦啦啦啦')
            this.page++
            this.getPresaleList()
        },
    }
}

</script>
<style lang='less' scoped>
.storeInfo{
    width: 100%;
    padding: 0.2rem 4%;
    border-radius: 0.1rem;
    background-image:  linear-gradient(#bbc1f3, #8eb0e4);
}
.contentlist{
    background-color: #f1f1f1;
    padding: 0.4rem 5%;
    
    .list{
        padding: 0.3rem 0.2rem;
        border-radius: 0.1rem;
    }
    .txt{
        margin-top: 4rem;
    }
}
</style>
